function h=hypervolumemetric(ObjVals1,rp)
    %%%%%%%%%%%%%%hypervolume%%%%%%%%%%%%%%%%%%%%
    %ObjVals1,ObjVals2 denotes the obtained solutions, the reference point
    %is calculated as follows.
    %set reference point: max value of each dimension
    %end the reference point calculate
    % initialize 
    [nmbOfVars,nmbOfIndivs1]=size(ObjVals1);
    % the default value of reference point
    %compute the first approximate Pareto front's hypervolume
    [Obj sortId1]=sortrows(ObjVals1');
    ObjValsSorted1=Obj';
    x=zeros(nmbOfVars, nmbOfIndivs1);
    x(:,1)=rp-ObjValsSorted1(:,1);
    for j=2:nmbOfIndivs1
        x(1,j)=rp(1,:)-ObjValsSorted1(1,j);
        for k=2:nmbOfVars
            x(k,j)=ObjValsSorted1(k,j-1)-ObjValsSorted1(k,j);
            %x(k,j) = abs(x(k,j));
        end
    end
    h=abs(sum(prod(x)));
end
